﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using JDML.MappingClass;

namespace JDML.StaticExtensions
{
    public class MappingTable
    {
        private static Dictionary<Type, DAOMapping> mappingTable = new Dictionary<Type, DAOMapping>();
        public static void AddMapping(Type type, DAOMapping mapping)
        {
            if (mappingTable.ContainsKey(type))
            {
                mappingTable[type] = mapping;
            }
            else
            {
                mappingTable.Add(type, mapping);
            }
        }
        public static void RemoveMapping(Type type)
        {
            if (mappingTable.ContainsKey(type))
            {
                mappingTable.Remove(type);
            }
        }
        public static bool Contains(Type type)
        {
            return mappingTable.ContainsKey(type);
        }
        public static DAOMapping GetMapping(Type type)
        {
            if (mappingTable.ContainsKey(type))
            {
                return mappingTable[type];
            }
            else
            {
                return null;
            }
        }
    }
}
